/*
 Navicat Premium Data Transfer

 Source Server         : msw_raw
 Source Server Type    : SQLite
 Source Server Version : 3035005 (3.35.5)
 Source Schema         : main

 Target Server Type    : SQLite
 Target Server Version : 3035005 (3.35.5)
 File Encoding         : 65001

 Date: 28/02/2024 08:55:26
*/

PRAGMA foreign_keys = false;

-- ----------------------------
-- Table structure for phm_device
-- ----------------------------
DROP TABLE IF EXISTS "phm_device";
CREATE TABLE "phm_device" (
  "device_code" text NOT NULL,
  "config" text,
  "create_time" integer,
  "update_time" integer,
  PRIMARY KEY ("device_code")
);

-- ----------------------------
-- Records of phm_device
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for phm_equipment
-- ----------------------------
DROP TABLE IF EXISTS "phm_equipment";
CREATE TABLE "phm_equipment" (
  "equipment_code" text NOT NULL,
  "level" integer,
  "device_code" text,
  "equipment_name" text,
  "equipment_id" integer,
  "parent_id" integer,
  "nfc_code" text,
  "create_time" integer,
  "update_time" integer,
  PRIMARY KEY ("equipment_code")
);

-- ----------------------------
-- Records of phm_equipment
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for phm_equipment_config
-- ----------------------------
DROP TABLE IF EXISTS "phm_equipment_config";
CREATE TABLE "phm_equipment_config" (
  "equipment_code" text NOT NULL,
  "config" text,
  "create_time" integer,
  "update_time" integer,
  PRIMARY KEY ("equipment_code")
);

-- ----------------------------
-- Records of phm_equipment_config
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for phm_equipment_repair
-- ----------------------------
DROP TABLE IF EXISTS "phm_equipment_repair";
CREATE TABLE "phm_equipment_repair" (
  "equipment_code" text NOT NULL,
  "repair" text,
  "create_time" integer,
  "update_time" integer,
  PRIMARY KEY ("equipment_code")
);

-- ----------------------------
-- Records of phm_equipment_repair
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for phm_equipment_threshold
-- ----------------------------
DROP TABLE IF EXISTS "phm_equipment_threshold";
CREATE TABLE "phm_equipment_threshold" (
  "equipment_code" text NOT NULL,
  "support_type" text,
  "device_type" text,
  "threshold" integer,
  "acc_threshold" integer,
  "vel_threshold" integer,
  "create_time" integer,
  "update_time" integer,
  PRIMARY KEY ("equipment_code")
);

-- ----------------------------
-- Records of phm_equipment_threshold
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for phm_point
-- ----------------------------
DROP TABLE IF EXISTS "phm_point";
CREATE TABLE "phm_point" (
  "point_code" text NOT NULL,
  "device_code" text,
  "equipment_code" text,
  "point_name" text,
  "axial" text,
  "install_time" integer,
  "create_time" integer,
  "update_time" integer,
  PRIMARY KEY ("point_code")
);

-- ----------------------------
-- Records of phm_point
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for phm_point_bearing
-- ----------------------------
DROP TABLE IF EXISTS "phm_point_bearing";
CREATE TABLE "phm_point_bearing" (
  "point_code" text NOT NULL,
  "bearing" text,
  "create_time" integer,
  "update_time" integer,
  PRIMARY KEY ("point_code")
);

-- ----------------------------
-- Records of phm_point_bearing
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for phm_point_config
-- ----------------------------
DROP TABLE IF EXISTS "phm_point_config";
CREATE TABLE "phm_point_config" (
  "point_code" text NOT NULL,
  "config" text,
  "create_time" integer,
  "update_time" integer,
  PRIMARY KEY ("point_code")
);

-- ----------------------------
-- Records of phm_point_config
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for phm_point_device
-- ----------------------------
DROP TABLE IF EXISTS "phm_point_device";
CREATE TABLE "phm_point_device" (
   "id" integer NOT NULL,
   "point_code" text NULL,
   "device_code" text NULL,
   "create_time" integer,
   "update_time" integer,
   PRIMARY KEY ("id")
);

-- ----------------------------
-- Records of phm_point_device
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for phm_point_fault
-- ----------------------------
DROP TABLE IF EXISTS "phm_point_fault";
CREATE TABLE "phm_point_fault" (
  "point_code" text NOT NULL,
  "fault" text,
  "create_time" integer,
  "update_time" integer,
  PRIMARY KEY ("point_code")
);

-- ----------------------------
-- Records of phm_point_fault
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for raw_group
-- ----------------------------
DROP TABLE IF EXISTS "raw_group";
CREATE TABLE "raw_group" (
  "group_id" integer NOT NULL,
  "group_code" text,
  "timestamp" integer,
  "point_list" text,
  PRIMARY KEY ("group_id")
);

-- ----------------------------
-- Records of raw_group
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for raw_time
-- ----------------------------
DROP TABLE IF EXISTS "raw_time";
CREATE TABLE "raw_time" (
  "raw_id" integer NOT NULL,
  "event_time" integer,
  "ts" integer NULL,
  "device_code" text NULL,
  "point_code" text,
  PRIMARY KEY ("raw_id")
);

-- ----------------------------
-- Records of raw_time
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for raw_conn
-- ----------------------------
DROP TABLE IF EXISTS "raw_conn";
CREATE TABLE "raw_conn" (
  "raw_id" integer NOT NULL,
  "event_time" integer,
  "ts" integer NULL,
  "device_code" text NULL,
  "point_code" text,
  PRIMARY KEY ("raw_id")
);

-- ----------------------------
-- Records of raw_conn
-- ----------------------------
BEGIN;
COMMIT;

PRAGMA foreign_keys = true;
